package com.quickstart.topic.service;

import com.quickstart.common.date.DateTimeUtils;
import com.quickstart.entity.TopicEntity;
import com.quickstart.topic.dao.TopicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:wesley
 */

@Service
public class TopicService {

    @Autowired
    private TopicMapper topicMapper;


    public int save(TopicEntity topicEntity){
        topicEntity.setCreateTime(DateTimeUtils.getNowTime());
        return topicMapper.insert(topicEntity);
    }


    public List<TopicEntity> getAllTopic(){
        return topicMapper.getAllTopic();
    }

    public TopicEntity getTopicById(Integer id){
        return topicMapper.selectByPrimaryKey(id);
    }


}
